<?php
namespace Home\Controller;
use Think\Controller;
class TestController extends Controller {
    public function test(){
        $this->display();
    }
    public function send(){
        $phone=$_POST['phone'];
        $captcha=rand();
        session('captcha',$captcha);            
        require 'Sms.php';
        $sms = new \ Sms( array('api_key' => '1ad3271bebfc00f4d861e5d7b6504cd13' , 'use_ssl' => FALSE ) );
//send 单发接口
         $sms->send($phone , '验证码：'.$captcha.'【铁壳测试】');         
         $output=array();
         $output['info']='发送成功';
         $output['status']=1;        
         print json_decode($output);
         exit;
    }
    public function dotest(){
        $captcha=$_POST['captcha'];
        $data['username']=$_POST['username'];
        $data['pass']=$_POST['pass'];
        $data['phone']=$_POST['phone'];       
        if(session('captcha')==$captcha){
            $new=M('test');  
            $new->add($data);
        }
    }
}
